/*
 * @FilePath: http.js
 * @Author: 杜芬
 * @Date: 2024-06-12 10:20:19
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-06-12 10:51:35
 * Copyright: 2024 xxxTech CO.,LTD. All Rights Reserved.
 * @Descripttion: 页面
 */
// axios 基础封装
import  axios from 'axios'

const httpInstance = axios.create({
  baseURL :'http://pcapi-xiaotuxian-front-devtest.itheima.net',
  timeout:5000
})
// Set config defaults when creating the instance
// const instance = axios.create({
//   baseURL: 'https://api.example.com'
// });

// 添加请求拦截器
httpInstance.interceptors.request.use( config=> {
  // 在发送请求之前做些什么
  return config;
}, e=> Promise.reject(e));

// 添加响应拦截器
httpInstance.interceptors.response.use(res => res.data,e => {
  // 对响应数据做点什么
  return Promise.reject(e);
});

//拦截器
export default httpInstance
